<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>基本列表</title>

  <!-- 引入Vue -->
  <script type="text/javascript" src="/vue/vue.js"></script>

</head>
<body>
  <!-- 可以遍历数组，对象，字符串，指定的次数（1,2,3....） -->

  <!-- 创建一个容器 -->
  <div id="app">

    <!-- 遍历数组 -->
    <h2>遍历数组</h2>
    <ul>
      <li v-for="(person, index) of persons" :key="index" >
        {{person.name}}-- {{person.age}} -- {{index}}
      </li>
    </ul>

    <!-- 遍历对象 -->
    <h2>遍历对象</h2>
    <ul>
      <li v-for="(value, k) of car" :key="k" >
        {{k}}-- {{value}}
      </li>
    </ul>    

  </div>

  <script type="text/javascript">
    // 创建一个Vue实例
    new Vue({
      el: '#app',
      data: {
        persons: [
          { name: 'zzm', age: 18, sex: '男' },
          { name: 'mfr', age: 19, sex: '女' },
        ],

        car: {
          name: 'BMW',
          money: '60w',
          color: '影子灰',
          
        }
      
      },
    })
  </script>
</body>
</html>